package com.dylan.shot.head.config;

import com.dylan.shot.head.interceptor.GeneralAccessInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by Dylan on 2017/9/5.
 */
@Configuration
public class MyWebAppConfigurer extends WebMvcConfigurerAdapter {
    @Autowired
    private GeneralAccessInterceptor generalAccessInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 增加访问拦截器
        registry.addInterceptor(generalAccessInterceptor).excludePathPatterns("/static/**").addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}
